<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>优车处置附加信息页面</title>
<jsp:include page="../../import.jsp" flush="true" />
<jsp:include page="../assParking/assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<div id="pageInTab" class="pageInTab">
				<!-- 页签1：优车处置申请 -->
				<div tabid="tabA" title="优车处置附加信息" lselected="true">
					<form id="yc_dealCar">
						<div class="fieldset1 tabel_col clearFix">
							<div class="fieldBox col_33">
								<div class="label">申请人</div>
				                <div class="field">
				                    <span id="applyNm" name="applyNm"></span>
				                </div>
							</div>
				            <div class="fieldBox col_33">
								<div class="label">申请时间</div>
								<div class="field">
									<span id="applyDt" name="applyDt"></span>
								</div>
							</div>
				            <div class="fieldBox col_33">
								<div class="label">拖车标记</div>
								<div class="field">
									<span id="backedFlagCd" name="backedFlagCd"></span>
								</div>
							</div>
							<!-- 车辆交接单 -->
			                <div class="fieldBox col_33">
			                	<div class="label">车辆交接单</div>
			                    <div class="field">
			                    	 <c:if test="${flag == '8' }">
			                         	<a class="modify" href="javascript:void(0);" onclick="entryOrder('out')">出库</a>
			                    	 </c:if>  
			                         <a class="detail" href="javascript:void(0);" onclick="entryOrder('detail')">查看</a>
			                    </div>
			                </div>
			                <div class="fieldBox col_66 tcjjd">
			                    <div class="field">
			                         <a href="javascript:void(0);" onclick="exportAssCarHvPdf()">导出</a>
			                    </div>
			                </div>
                            <!-- 上传附件 -->
                            <div class="fieldBox col_100">
                                <div class="label">附件上传</div>
                                <div class="fieldset1 tabel_col clearFix dealFileGrid">
                                    <div class="sqPanel_body">
                                        <div id="dealFileGrid" class="sq-grid"></div>
                                    </div>
                                </div>
                            </div>
			                <!-- 车辆出入库资料  -->
							<div class="caption crkzl">
								<span class="title">车辆出入库资料</span>
							</div>
							<!-- 附件显示 -->
							<div class="fieldBox col_100">
								<div style="width: 98%; margin-left: 1%;">
									<jsp:include page="../assCommFilesList.jsp" flush="true" ></jsp:include>
									<div id="ligergrid_file0" class="sq-grid"></div>
								</div>
							</div>
							<div class="fieldBox col_33">
								<div class="label">处置接收人类型</div>
								<div class="field">
									<select name="buyerTypeCd" id="buyerTypeCd" ligerui="width: 160" >
										<option value="" selected>请选择</option>
										<c:forEach items="${buyerTypeList }" var="buyer">
										   <c:if test="${buyer.key == '1' || buyer.key == '2' }">
											<option value="${buyer.key }">${buyer.value }</option>
											</c:if>
										</c:forEach>
									</select>
								</div>
							</div>
				            <div class="fieldBox col_33 edit_fqr">
								<div class="label">处置金额(元)</div>
								<div class="field">
									<input type="text" id="sellAmt" name="sellAmt" class="ui-textbox" ligerui="width: 160" value="">
								</div>
							</div>
							 <div class="fieldBox col_33 show_fqr">
								<div class="label">处置金额(元)</div>
								<div class="field">
								    <span id="sellAmt_1" name="sellAmt_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 ">
								<div class="label">处置路径</div>
								<div class="field">
									<select name="sellChannelCd" id="sellChannelCd" ligerui="width: 160">
										<option value="" selected>请选择</option>
										<c:forEach items="${sellChannelList }" var="sell">
											<option value="${sell.key }">${sell.value }</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<!-- 个人信息 -->
							<div class="fieldBox col_33 person_edit Hide">
								<div class="label">处置接收人姓名</div>
								<div class="field">
									<input type="text" id="buyerNm" name="buyerNm" class="ui-textbox" ligerui="width: 160" value="" >
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 person_show Hide">
								<div class="label">处置接收人姓名</div>
								<div class="field">
									<span id="buyerNm_1" name="buyerNm_1">&nbsp;</span>
								</div>
							</div>
				            <div class="fieldBox col_33 person_edit Hide">
								<div class="label">处置接收人证件号</div>
								<div class="field">
									<input type="text" id="buyerCd" name="buyerCd" class="ui-textbox" ligerui="width: 160" value="" >
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							 <div class="fieldBox col_33 person_show Hide">
								<div class="label">处置接收人证件号</div>
								<div class="field">
									<span id="buyerCd_1" name="buyerCd_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 person_edit Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<input type="text" id="buyerTel" name="buyerTel" class="ui-textbox" ligerui="width: 160" value="" >
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 person_show Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<span id="buyerTel_1" name="buyerTel_1">&nbsp;</span>
								</div>
							</div>
							<!-- 企业信息 -->
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label">处置接收企业名称</div>
								<div class="field">
									<input type="text" id="buyerCompanyNm" name="buyerCompanyNm" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label">处置接收企业名称</div>
								<div class="field">
									<span id="buyerCompanyNm_1" name="buyerCompanyNm_1">&nbsp;</span>
								</div>
							</div>
				            <div class="fieldBox col_33 company_edit Hide">
								<div class="label">处置接收企业联系人</div>
								<div class="field">
									<input type="text" id="buyerCompanyContact" name="buyerCompanyContact" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							   <div class="fieldBox col_33 company_show Hide">
								<div class="label">处置接收企业联系人</div>
								<div class="field">
									<span id="buyerCompanyContact_1" name="buyerCompanyContact_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<input type="text" id="buyerCompanyTel" name="buyerCompanyTel" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label">联系方式</div>
								<div class="field">
									<span id="buyerCompanyTel_1" name="buyerCompanyTel_1">&nbsp;</span>
								</div>
							</div>
							
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label">组织机构代码证</div>
								<div class="field">
									<input type="text" id="buyerCompanyCode" name="buyerCompanyCode" class="ui-textbox" ligerui="width: 160" value="" validate="{required:false}">
									<span class="requiredSymbol">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label">组织机构代码证</div>
								<div class="field">
									<span id="buyerCompanyCode_1" name="buyerCompanyCode_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_edit Hide">
								<div class="label"></div>
								<div class="field">
									<span >&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label"></div>
								<div class="field">
									<span >&nbsp;</span>
								</div>
							</div>
								<div class="fieldBox col_33 company_edit Hide">
								<div class="label"></div>
								<div class="field">
									<span >&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 company_show Hide">
								<div class="label"></div>
								<div class="field">
									<span >&nbsp;</span>
								</div>
							</div>
							<!-- 处置信息 -->
				            <div class="fieldBox col_100 edit_fqr">
								<div class="label">处置说明</div>
								<div class="field">
									<textarea name="sellDesc" id="sellDesc" rows="3" class="l-textarea" style="width:98%" value="" ></textarea>
								</div>
							</div>
							 <div class="fieldBox col_100 show_fqr">
								<div class="label">处置说明</div>
								<div class="field">
								    <span id="sellDesc_1" name="sellDesc_1">&nbsp;</span>
								</div>
							</div>
                            <div class="fieldBox col_33">
                                <div class="label">处置金额/处置评估价</div>
                                <div class="field">
                                    <span id="sellEstiAmt_1" name="sellEstiAmt_1" ligerui="width: 300">&nbsp;</span>
                                </div>
                            </div>
                            <div class="fieldBox col_33 ">
                                <div class="label">处置金额/保底价</div>
                                <div class="field">
                                    <span id="baseAmt_1" name="baseAmt_1" ligerui="width: 160">&nbsp;</span>
                                </div>
                            </div>
								<!-- 处置上传附件 -->
							<div class="fieldBox col_100 edit_fqr">
								<div class="label">附件上传</div>
								<div class="field">
									<jsp:include page="../assCommFilesUpload.jsp" flush="true" >
										<jsp:param name="filePath" value="ass"/>
									</jsp:include>
									<div id="fileUpload1" class="upfileBoxs"></div>
									<span class="sq-button sq-button-hasicon" id="btnUpload1" onclick="ajaxFileUploadImg('uploads1',1)">
										<i class="sqBtnIco_9"></i>上传
									</span>
								</div>
							</div>
							<!-- 附件显示 -->
							<div class="fieldBox col_100">
								<div style="width: 98%; margin-left: 1%;">
									<div id="ligergrid_file1" class="sq-grid"></div>
								</div>
							</div>
							<div class="btnsBox">
							<span id="saveDealSell_apply" class="sq-button sq-button-round" onclick="saveDealSell()">保存</span>
							</div>
							
							<!-- 付款信息 -->
							<div class="caption fkxx">
								<span class="title">付款方</span>
							</div>
							<div class="fieldBox col_100">
								<div class="sqPanel">
									<div id="detailGrid">
										<div style="text-align: right;line-height: 2.3em;" class="edit_gps_st">
											<c:if test="${flag == '4' }">
												<span id="editPayInfo" class="sq-button sq-button-round" onclick="editPayInfo('')">添加</span>
											</c:if>
										</div>
										<!-- 实际到账信息列表显示块 -->
										<div id="ligergrid3" class="sq-grid"></div>
									</div>
								</div>
							</div>
							<!-- 来款凭证上传附件  -->
							<c:if test="${flag == '4' }">
							<div class="fieldBox col_100">
								<div class="label">来款凭证上传</div>
								<div class="field">
									<div id="fileUpload2" class="upfileBoxs"></div>
									<span class="sq-button sq-button-hasicon" id="btnUpload2" onclick="ajaxFileUploadImg('uploads2',2)">
										<i class="sqBtnIco_9"></i>上传
									</span>
								</div>
							</div>
							</c:if>
							<!-- 来款凭证附件显示 -->
							<div class="fieldBox col_100">
								<div style="width: 98%; margin-left: 1%;">
									<div id="ligergrid_file2" class="sq-grid"></div>
								</div>
							</div>
							<c:if test="${flag == '4' }">
							<div class="btnsBox">
							  <span id="savePayInfoFileBtn" class="sq-button sq-button-round" onclick="javascript:saveFile('lkpz_cz')">保存</span>
							</div>
							</c:if>
							
							
							<!-- 收款信息 -->
							<div class="caption fkxx">
								<span class="title">收款方</span>
							</div>
							<div class="fieldBox col_33 edit_payer">
								<div class="label">收款银行</div>
								<div class="field">
									<input name="payeeBankNm" id="payeeBankNm" value="" type="text" class="ui-textbox" validate="">
									<span style="color:red;">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 show_payer">
								<div class="label">收款银行</div>
								<div class="field">
									<span id="payeeBankNm_1" name="payeeBankNm_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_payer">
								<div class="label">收款账号</div>
								<div class="field">
									<input name="payeeAccNo" id="payeeAccNo" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_payer">
								<div class="label">收款账号</div>
								<div class="field">
								    <span id="payeeAccNo_1" name="payeeAccNo_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_payer">
								<div class="label">收款方名称</div>
								<div class="field">
									<input name="payeeAccNm" id="payeeAccNm" value="" type="text" class="ui-textbox" validate="">
								</div>
							</div>
							<div class="fieldBox col_33 show_payer">
								<div class="label">收款方名称</div>
								<div class="field">
								    <span id="payeeAccNm_1" name="payeeAccNm_1">&nbsp;</span>
								</div>
							</div>
							<div class="btnsBox">
								<span id="saveDealSell" class="sq-button sq-button-round" onclick="saveDealSell()">保存</span>
							</div>
							<div class="fieldBox col_33">
								<div class="label">二次评估价(元)</div>
				                <div class="field">
				                    <span id="baseAmt" name="baseAmt">${baseAmt}</span>
				                </div>
							</div>
				            <div class="fieldBox col_33">
								<div class="label"></div>
								<div class="field"></div>
							</div>
				            <div class="fieldBox col_33">
								<div class="label"></div>
								<div class="field"></div>
							</div>


							<!-- 提车人信息 -->
							<div class="caption fkxx">
								<span class="title">提车人信息</span>
							</div>
							<div class="fieldBox col_33 edit_picker">
								<div class="label">提车人姓名</div>
								<div class="field">
									<input name="pickCarNm" id="pickCarNm" value="" type="text" class="ui-textbox" validate="">
									<span style="color:red;">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 show_picker">
								<div class="label">提车人姓名</div>
								<div class="field">
								    <span id="pickCarNm_1" name="pickCarNm_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_picker">
								<div class="label">提车人联系电话</div>
								<div class="field">
									<input name="pickCarTel" id="pickCarTel" value="" type="text" class="ui-textbox" validate="">
									<span style="color:red;">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 show_picker">
								<div class="label">提车人联系电话</div>
								<div class="field">
								    <span id="pickCarTel_1" name="pickCarTel_1">&nbsp;</span>
								</div>
							</div>
							<div class="fieldBox col_33 edit_picker">
								<div class="label">提车人身份证号</div>
								<div class="field">
									<input name="pickCarCd" id="pickCarCd" value="" type="text" class="ui-textbox" validate="">
									<span style="color:red;">*</span>
								</div>
							</div>
							<div class="fieldBox col_33 show_picker">
								<div class="label">提车人身份证号</div>
								<div class="field">
								    <span id="pickCarCd_1" name="pickCarCd_1">&nbsp;</span>
								</div>
							</div>
							<!-- 上传提车人附件 start -->
							<div class="fieldBox col_100 edit_picker">
								<div class="label">附件上传</div>
								<div class="field">
									<div id="fileUpload3" class="upfileBoxs"></div>
									<span class="sq-button sq-button-hasicon" id="btnUpload3" onclick="ajaxFileUploadImg('uploads3',3)">
										<i class="sqBtnIco_9"></i>上传
									</span>
								</div>
							</div>
							<!-- 上传提车人附件 start  end -->
							<!-- 附件显示 -->
							<div class="fieldBox col_100">
								<div style="width: 98%; margin-left: 1%;">
									<div id="ligergrid_file3" class="sq-grid"></div>
								</div>
							</div>
							<div class="btnsBox">
								<span id="saveDealSell_picker" class="sq-button sq-button-round" onclick="saveDealSell()">保存</span>
							</div>
							<!-- 隐藏支付表主键、支付表号 -->
			                <div class="fieldBox col_100" style="display:none;">
			                    <div class="field">
			                         <input name="tcMasterId" id="tcMasterId" type="text" class="ui-textbox" value="${tcMasterId}">
			                         <input name="tcDetailId" id="tcDetailId" type="text" class="ui-textbox" value="${tcDetailId}">
                                     <input name="wsPaySchId" id="wsPaySchId" type="text" class="ui-textbox" value="${wsPaySchId}">
                                     <input name="wsPaySchNo" id="wsPaySchNo" type="text" class="ui-textbox" value="${wsPaySchNo}">
			                         <input name="deal_Id" id="deal_Id" type="text" class="ui-textbox" value="${yc_deal_Id}">
			                         <input name="processId" id="processId" type="text" class="ui-textbox" value="${processId}">
			                         <input name="taskDefKey" id="taskDefKey" type="text" class="ui-textbox" value="${taskDefKey}">
			                         <input name="cstId" id="cstId" type="text" class="ui-textbox" value="${cstId}">
			                         <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="${cstNm}">
			                         <input name="orgName" id="orgName" type="text" class="ui-textbox" value="${orgName}">
			                         <input name="buOrgCd" id="buOrgCd" type="text" class="ui-textbox" value="${buOrgCd}">
			                         <input name="flag" id="flag" type="text" class="ui-textbox" value="${flag }">
			                         <input name="assDealRecAmt_id" id="assDealRecAmt_id"  class="ui-textbox">
			                         <!-- 上传文件使用：系统时间和当前登录人姓名 -->
			                         <input name="sysDate" id="sysDate" type="text" class="ui-textbox" value="${sysDate }">
			                         <input name="loginUsrNm" id="loginUsrNm" type="text" class="ui-textbox" value="${loginUsrNm }">
			                    </div>
			                </div>
							<!-- 提报费用信息 -->
							<div class="caption">
								<span class="title">提报费用信息</span>
							</div>
							<div class="fieldBox col_100">
								<div class="sqPanel">
									<div id="detailGrid">
										<div style="text-align: right;line-height: 2.3em;" class="edit_gps_st">
											<c:if test="${flag == '10' }">
												<span id="saveDealSell_apply" class="sq-button sq-button-round" onclick="toAddCost()">添加</span>
											</c:if>
										</div>
										<!-- 提报费用信息列表显示块 -->
										<div id="ligergrid2" class="sq-grid"></div>
									</div>
								</div>
							</div>
						</div>
					</form>
					<%--绑定资金--%>
					<%--<jsp:include page="../../capital/capFund/capFundAddInFlow.jsp" flush="true">
                        <jsp:param name="relationBizId" value="${paySchId}"/>
                        <jsp:param name="isDetail" value="${isDetail}"/>
                    </jsp:include>--%>
					<c:if test="${bizTyp=='3' }">
						<jsp:include page="../../capital/capFund/capFundAddBind.jsp" flush="true"></jsp:include>
					</c:if>
				</div>
				<!-- 页签2：拖车单信息 -->
				<div tabid="tabB" title="拖车单信息" id="tabBId" style="dis">
					<iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
				</div>
			</div>
		</div>
	</div>

    <script>
	    var pageInApp={
				flag:false //tab页验证关闭
		};//to下一级子窗口 接口
		var pageInTab=null;//页签
		var loadedTabs=[];//页签

		//是否隐藏：付款方的操作
		var isDetail = '${isDetail}';
		var isShow_flag = (isDetail == '0');
		var l_hidden = isShow_flag ? "l-hidden" : "";
        var sellId = $("#deal_Id").val();
	    $(function() {
	    	initForm();//初始化表单
	    	initData();//初始化数据
	    	//initDataRectAmt();//初始化付款信息
	        initTab();//初始化页签
	        initRequiredAttr();//设置显示属性
            initDealFileGrid();
	    });

        var dealFileGrid = null;

        // 维护过户方案资料Grid
        function initDealFileGrid() {
            dealFileGrid = $("#dealFileGrid").ligerGrid({
                url: '<%=path%>/ass/assDealSell/initDealFileGrid.do?id=' + sellId + '&cfgCd=ASS008',
                method: 'get',
                columns: [
                    {display: '资料名称', name: 'datNm', align: 'center', minWidth: 100, enabledSort: false},
                    {
                        display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                        render: function (rowdata, rowindex, value) {
                            if (value) {
                                var h;
                                h = '<a href="javascript:downloadFileByUrl(';
                                h += "'" + rowdata.filePath + "'";
                                h += ",'" + rowdata.fileNm + "'";
                                h += ')">' + rowdata.fileNm + '</a>'
                                return h;
                            }
                        }
                    },
                    {
                        display: '上传时间',
                        name: 'crtTm',
                        align: 'center',
                        width: 150,
                        enabledSort: false,
                        render: renderDate
                    }
                ],
                root: 'rows',
                hideLoadButton: true,
                width: '100%',
                height: '200px',
                isScroll: false,
                rownumbers: true,  //显示序号
                checkbox: false,
                allowUnSelectRow: true,
                alternatingRow: false,
                frozen: false,
                usePager: false,
                onAfterShowData: function () {
                    $('#dealFileGrid').rowspan('datNm');
                    $('#dealFileGrid').rowspan('operate');
                },
            });
        }

        //下载文件方法
        function downloadFileByUrl(_url,_name){
            if(SQ.regs.img.test(_name)){
                SQ.imgPreview(_url, true);
            }else{
                window.open(_url);
            }
        }

        // 上传文件a标签链接到input标签上
        function uploadFile(cfgCd, cfgDtlCd) {
            document.getElementById("uploadInput_" + cfgCd + "_" + cfgDtlCd).click();
        }

        /**
         * 上传文件
         * @param e
         * @param cfgCd
         * @param cfgDtlCd
         * @param orgCd
         */
        function onChangefile_multi(e, cfgCd, cfgDtlCd, orgCd) {
            var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            var filePath = "";
            filePath = "assDealFile";
            $.ajaxFileUpload({
                url: '<%=path%>/system/sysulfilesrec/upload.do',
                secureuri: false,
                fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
                dataType: 'json',
                data: {filePath: filePath},
                success: function (msg) {
                    if (msg.success == 1) {
                        $.ajax({
                            type: 'post',
                            dataType: 'json',
                            data: {
                                'fileParams': JSON.stringify(msg.data),
                                'id': sellId,
                                'cfgCd': cfgCd,
                                'cfgDtlCd': cfgDtlCd,
                                'orgCd': orgCd
                            },
                            url: '<%=path%>/ass/assDealSell/uploadDealFile.do',
                            success: function (msg) {
                                if (msg.success == 1) {
                                    dealFileGrid.reload();
                                } else {
                                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                }
                                $.ligerDialog.hide();
                            }
                        });
                    } else {
                        wait_dialog.close();
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        };

        // 格式化时间
        function renderDate(rowdata, index, value) {
            var dateStr = "";
            if (null != value) {
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }
		
		function toAddCost(){
			   $.ligerDialog.open({
	                width:800,
	                height: 350,
	                title: '添加提报费用',
	                url: '<%=path%>/ass/assTrailCarD/toAddCostPage.do?carId='+$("#deal_Id").val()
	            });
		}
		//初始化表单
		function initForm(){
	    	$("#yc_dealCar").ligerForm({
				validate: true
			});
			$("#yc_dealCar").check_ligerFormEditor();//重新刷新页面动态字段
			//初始化处置接受人类型-change方法
			liger.get('buyerTypeCd').bind('changeValue', function () {
				selectChange();
			});
		};
	    
		//初始化Tab页签
		function initTab(){
			var crflag = "";
			var flag = $("#flag").val();
			if(flag == "9"){//资产管理员出库登记
				crflag = "out";//出库
			}else{
				crflag = "detail";//查看
			}
			pageInTab = $("#pageInTab").ligerTab({
				height: 'auto',
				contextmenu: false,
				minIframeHeight: GET_minIframeHeight(),
				onAfterSelectTabItem: function(tabid) {
					//获取拖车主表ID和明细表ID供其它页面使用
					var tcMasterId = $("#tcMasterId").val();
					var tcDetailId = $("#tcDetailId").val();
					var busid= $("#deal_Id").val();
					var processId= $("#processId").val();
					var taskDefKey= $("#taskDefKey").val();
					if(tabid!="tabA"){
						if(!tcDetailId || !tcMasterId){
							$.ligerDialog.SQalert({content: "抱歉信息不存在！", SQ_type: "warning"});
							return false; //验证不通过，不执行以下代码
						}
					}
					switch (tabid){
						case "tabB":
							if(flag == "6"||flag == "11"){
								pageInTab.setTabItemSrc(tabid, "<%=path%>/ass/assTrailCarM/toInfoViewPage.do?tcMasterId="+tcMasterId+"&tcDetailId="+tcDetailId+"&crflag="+crflag+"&busid="+busid+"&processId="+processId+"&taskDefKey="+taskDefKey);
								break;
							}else{
								pageInTab.setTabItemSrc(tabid, "<%=path%>/ass/assTrailCarM/toInfoViewPage.do?tcMasterId="+tcMasterId+"&tcDetailId="+tcDetailId+"&crflag="+crflag);
								break;
							}
					}
					SetIframe_height();
				}
			});
			//设置页签
			$.extend(true, pageInApp, {
				pageInTab: pageInTab
			});
		};
		
		 //初始化数据
	    function initData(){
			var yc_deal_Id = $("#deal_Id").val();
	    	if(!yc_deal_Id){
	    		$.ligerDialog.SQalert({content: "处置ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}
	    	var _url = '<%=path%>/ass/assTrailCarD/getDealInfoById.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{dealId:yc_deal_Id},
	    		url: _url,
	    		success:function(msg){
	    			 if(msg.success == 1){
	    				 setData(msg.data);//设置数据
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
		 }
		
	    //初始化数据
	    function initDataRectAmt(){
	    		var yc_deal_Id = $("#deal_Id").val();
	        	if(!yc_deal_Id){
	        		$.ligerDialog.SQalert({content: "处置ID为空,无法查询相关信息！",SQ_type: "error"});
	        		return;
	        	}
	        	//加载处置收款表信息
	        	var _url = '<%=path%>/ass/assTrailCarM/getAssDealRecAmtList.do';
	        	$.ajax({
	        		type: 'get',
	        		dataType:'json',
	        		data:{dataId:yc_deal_Id,dataTypeCd:1},
	        		url: _url,
	        		success:function(msg){
	        			 if(msg.success == 1){
	        				 setDataRectAmt(msg.data);//设置数据
	        			 }else{
	        				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	        			 }
	        		}
	        	});
		
	 }
	    //设置页面数据
	    function setData(data){
	    	//加载表单
	    	var form = liger.get("yc_dealCar");
	    	//收款方默认：狮桥中国
	    	var payeeAccNm = data.payeeAccNm;
	    	if(payeeAccNm == null){
	    		payeeAccNm = "狮桥中国";
	    	}
			form.setData({
				sellAmt: data.sellAmt/100,//处置金额
				sellDesc: data.sellDesc,//处置说明
				payeeBankNm: data.payeeBankNm,//收款银行
				payeeAccNo: data.payeeAccNo,//收款账号
				payeeAccNm: payeeAccNm,//收款方名称
				pickCarNm: data.pickCarNm,//提车人姓名
				pickCarTel:data.pickCarTel,//提车人联系电话
				pickCarCd:data.pickCarCd,//提车人身份证号
				
				buyerTypeCd: data.buyerTypeCd,
				sellChannelCd: data.sellChannelCd,
				buyerNm: data.buyerNm,
				buyerCd: data.buyerCd,
				buyerTel: data.buyerTel,
				buyerCompanyNm: data.buyerCompanyNm,
				buyerCompanyContact: data.buyerCompanyContact,
				buyerCompanyTel: data.buyerCompanyTel,
				buyerCompanyCode: data.buyerCompanyCode,
				
	    	});
			//加载日期插件
			//$("#backDt").trigger("change"); 
			//显示申请信息
			$("#applyNm").html(data.applyNm);
 	    	$("#applyDt").html(renderDate1(data.crtTm));
			$("#backedFlagCd").html(data.backedFlagCd);
            if(data.sellEstiAmt == null){
                $("#sellEstiAmt_1").html(0+"%");//处置金额/市场评估价
            }else{
                var result = (( data.sellAmt / 100)/data.sellEstiAmt/100)*100+"";
                var last_result=Number(result.toString().match(/^\d+(?:\.\d{0,2})?/)) ;
                $("#sellEstiAmt_1").html(last_result+"%"); //处置金额/市场评估价
            }
            if(data.sellAmt == null){
                $("#baseAmt_1").html(0+"%");//处置金额/保底价
            }else{
                var result = ((data.sellAmt / 100)/(data.baseAmt / 100))*100;
                var last_result=Number(result.toString().match(/^\d+(?:\.\d{0,2})?/)) ;
                //var last_result = result.substring(0,result.indexOf(".") + 3);
                $("#baseAmt_1").html(last_result+"%"); //处置金额/保底价
            }

            //设置显示信息
			$("#sellAmt_1").html(data.sellAmt / 100);
			$("#buyerNm_1").html(data.buyerNm);
			$("#buyerCd_1").html(data.buyerCd);
			$("#buyerTel_1").html(data.buyerTel);
			$("#buyerCompanyNm_1").html(data.buyerCompanyNm);
			$("#buyerCompanyContact_1").html(data.buyerCompanyContact);
			$("#buyerCompanyTel_1").html(data.buyerCompanyTel);
			$("#buyerCompanyCode_1").html(data.buyerCompanyCode);
			$("#sellDesc_1").html(data.sellDesc);
			$("#payeeBankNm_1").html(data.payeeBankNm);//收款银行
			$("#payeeAccNo_1").html(data.payeeAccNo);//收款账号
			$("#payeeAccNm_1").html(payeeAccNm);//收款方名称
			$("#pickCarNm_1").html(data.pickCarNm);//提车人姓名
			$("#pickCarTel_1").html(data.pickCarTel);//提车人联系电话
			$("#pickCarCd_1").html(data.pickCarCd);//提车人联系电话
 	    	//设置拖车信息主键值
 	    	$("#tcMasterId").val(data.masterId);
			$("#tcDetailId").val(data.detailId);
			loadFilesLiger("tccz", 1, $("#deal_Id").val());//加载处置申请文件列表信息
	    	loadFilesLiger("cztcr", 3, $("#deal_Id").val());//加载处置提车人文件列表信息
	    	loadFilesLiger("crkzl", 0, data.detailId);//加载出入库文件列表信息
	    	loadFilesLiger("lkpz_cz", 2, $("#deal_Id").val());//加载处置来款凭证文件列表信息
	    	showOrEdit(data);
	    }
	    
	    //设置页面数据
	    function setDataRectAmt(data){
	    	//加载表单
	    	var form = liger.get("yc_dealCar");
			form.setData({
				payerBankNm:data.payerBankNm,//银行信息
				payerAccNo:data.payerAccNo,//账号信息
				payerAccNm: data.payerAccNm,//付款方名称
				fReceivedAmt: data.receivedAmt / 100, //付款金额
				fReceivedTm: renderDate1(data.receivedTm),//付款时间
				assDealRecAmt_id:data.id
	    	});
			$("#payerBankNm_1").html(data.payerBankNm);//银行信息
			$("#payerAccNo_1").html(data.payerAccNo);//账号信息
			$("#payerAccNm_1").html(data.payerAccNm);//付款方名称
			$("#fReceivedAmt_1").html(data.receivedAmt / 100);//付款金额
			$("#fReceivedTm_1").html(renderDate1(data.receivedTm));//付款时间
			//加载日期插件
			$("#fReceivedTm").trigger("change"); 
	    }
	  	//处置接受人类型
		function selectChange(){
			var buyerTypeCd_val=$("#buyerTypeCd").val();
            var formSet1=liger.get("yc_dealCar");
            if (buyerTypeCd_val == "") {
				$("#yc_dealCar").find(".company_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#yc_dealCar").find(".person_edit").each(function (){
	        		$(this).addClass('Hide');
	        	});
            }else if (buyerTypeCd_val == "1") {//企业
				$("#yc_dealCar").find(".company_edit").each(function (){
	        		$(this).removeClass('Hide');
	        	});
				$("#yc_dealCar").find(".person_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				//取消个人《必选》验证规则
                formSet1.setFieldValidate("buyerNm", {required: false});
                formSet1.setFieldValidate("buyerCd", {required: false});
                formSet1.setFieldValidate("buyerTel", {required: false});
				//设置企业《必选》验证规则
                formSet1.setFieldValidate("buyerCompanyNm", {required: true});
                formSet1.setFieldValidate("buyerCompanyContact", {required: true});
                formSet1.setFieldValidate("buyerCompanyTel", {required: true});
                formSet1.setFieldValidate("buyerCompanyCd", {required: true});
                
            }else if (buyerTypeCd_val == "2") {//个人
				$("#yc_dealCar").find(".person_edit").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#yc_dealCar").find(".company_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				//取消企业《必选》验证规则
                formSet1.setFieldValidate("buyerCompanyNm", {required: false});
                formSet1.setFieldValidate("buyerCompanyContact", {required: false});
                formSet1.setFieldValidate("buyerCompanyTel", {required: false});
                formSet1.setFieldValidate("buyerCompanyCd", {required: false});
				//设置个人《必选》验证规则
                formSet1.setFieldValidate("buyerNm", {required: true});
                formSet1.setFieldValidate("buyerCd", {required: true});
                formSet1.setFieldValidate("buyerTel", {required: true});
            }
		}
		 
		//设置显示属性
		function initRequiredAttr(){
	            var buyerTypeCd_val=$("#buyerTypeCd").val();
	            var formSet1=liger.get("yc_dealCar");
	            if($("#flag").val() == '2'){
	            	 if (buyerTypeCd_val == "1") {//企业
	 					//取消个人《必选》验证规则
	 	                formSet1.setFieldValidate("buyerNm", {required: false});
	 	                formSet1.setFieldValidate("buyerCd", {required: false});
	 	                formSet1.setFieldValidate("buyerTel", {required: false});
	 					//设置企业《必选》验证规则
	 	                formSet1.setFieldValidate("buyerCompanyNm", {required: true});
	 	                formSet1.setFieldValidate("buyerCompanyContact", {required: true});
	 	                formSet1.setFieldValidate("buyerCompanyTel", {required: true});
	 	                formSet1.setFieldValidate("buyerCompanyCode", {required: true});
	 	            }else if (buyerTypeCd_val == "2") {//个人
	 					//取消企业《必选》验证规则
	 	                formSet1.setFieldValidate("buyerCompanyNm", {required: false});
	 	                formSet1.setFieldValidate("buyerCompanyContact", {required: false});
	 	                formSet1.setFieldValidate("buyerCompanyTel", {required: false});
	 	                formSet1.setFieldValidate("buyerCompanyCode", {required: false});
	 					//设置个人《必选》验证规则
	 	                formSet1.setFieldValidate("buyerNm", {required: true});
	 	                formSet1.setFieldValidate("buyerCd", {required: true});
	 	                formSet1.setFieldValidate("buyerTel", {required: true});
	 	            }
	            }else{
	            	//取消企业《必选》验证规则
 	                formSet1.setFieldValidate("buyerCompanyNm", {required: false});
 	                formSet1.setFieldValidate("buyerCompanyContact", {required: false});
 	                formSet1.setFieldValidate("buyerCompanyTel", {required: false});
 	                formSet1.setFieldValidate("buyerCompanyCode", {required: false});
 					//取消个人《必选》验证规则
 	                formSet1.setFieldValidate("buyerNm", {required: false});
 	                formSet1.setFieldValidate("buyerCd", {required: false});
 	                formSet1.setFieldValidate("buyerTel", {required: false});
	            }
	           
		}
		
		//保存文件-获取对应上传组件的文件列表
		function saveFile(type){
			var index = 1;//处置申请附件
			var eflag = "tccz";
			var flag = $("#flag").val();
			if(flag == "7" || flag == "4"){
				index = 3;//提车人附件
				eflag = "cztcr";
			}
			if(flag == "4" && type =='lkpz_cz'){
				index = 2;//来款凭证附件
				eflag = "lkpz_cz";
			}
			var docArray = JSON.stringify(getUploadResultParams(index));
	        var url = "<%=path%>/ass/assTrailCarD/uploadAttchment.do";
	        var dealId = $("#deal_Id").val();
        	if(null == docArray){
        		return false;
        	}else{
		        if(dealId){//拖车主表ID不为空执行
			        //赋值附件
			        var data = {
						"docArray":docArray,
						"pkId":dealId,
						"flag": eflag
					};
					//请求
			        AjaxUtils.ajaxPost(url, data, function(msg){
			        	if(msg.success == 1){
							 if(msg.data){
								 //刷新附件页面GRID方法和清空上传按钮
								 refreshUlFileRecList(index);
								 clearUploadResultParams(index);
							 }
							 if(type == 'lkpz_cz'){
									top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
							 }
						 }else{
							 UIUtils.alertError(msg.info);
						 }
			        }, true);
		        }else{
		        	$.ligerDialog.SQalert({content: "业务主键为空-不能保存文件！",SQ_type: "error"});
		        }
        	}
		}
		
		//显示已上传但是未保存的文件列表
		function showFiles(data, index){
			var sysDate = $("#sysDate").val();
			var loginUsrNm = $("#loginUsrNm").val();
			var f_Grid = liger.get("ligergrid_file"+index);
			var uploadJOSN = data;
    		for (var i=0; i< uploadJOSN.length; i++){ 
        		//添加行-追加行
        		f_Grid.addRow({fileNm: uploadJOSN[i].fileNm, crtUsrRlNm: loginUsrNm, crtTm: sysDate, doSthFlag: "1", ligerIndex: index,id:i});
    		}
		}
		
		//保存付款方信息（处置收款表）
		function updateAssDealRecAmt(){
			var ligerForm = liger.get("yc_dealCar");
			//获取优车处置ID-为空提示
			var deal_Id = $("#deal_Id").val();
			if(!deal_Id){
				top.$.ligerDialog.SQalert({content: "优车处置主键不存在！",SQ_type: "warning"});
				return false;
			}
			if($("#payerBankNm").val()=="" || $("#payerAccNm").val() =="" || $("#fReceivedAmt").val() ==""||$("#fReceivedTm").val()=="" ){
				top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
				return false; //验证不通过，不执行以下代码
			}
			//获取表单数据
			var data = ligerForm.getData();
			data["dataTypeCd"]=1;
			data["dataId"]= deal_Id;
			data["assDealRecAmt_id"] = $("#assDealRecAmt_id").val();
			console.log(data);
			//新增优车处置信息主表数据
			var wait_dialog = null;
			var url = '<%=path%>/ass/assTrailCarD/updateYCDealInfo.do';
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: url,
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					//返回的优车处置信息主表ID不为空执行一下操作
					if(msg.success == 1 ){
						//设置处置收款表ID值
						if(!assDealRecAmt_id && null != msg.data){
							$("#assDealRecAmt_id").val(msg.data);
						}
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
					}else{
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		
		//保存处置申请信息
		function saveDealSell(){
			var ligerForm = liger.get("yc_dealCar");
			if (!ligerForm.valid()) {
				top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
				return false; //验证不通过，不执行以下代码
			}
			if($("#flag").val()=='4'){//通知打款
				if($("#payeeBankNm").val()==""){
					top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
			}
			if($("#flag").val()=='7'){//呈报人添加提车人信息
				if($("#pickCarNm").val()=="" || $("#pickCarTel").val() == "" || $("#pickCarCd").val() == ""){
					top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
			}
			
			//获取处置主表ID-为空提示
			var dealId = $("#deal_Id").val();
			if(!dealId){
				top.$.ligerDialog.SQalert({content: "处置主表ID为空,无法保存！",SQ_type: "warning"});
				return false;
			}
			//获取表单数据
			var data = ligerForm.getData();
			console.log(data);
			//新增处置信息主表数据
			var wait_dialog = null;
			var url = '<%=path%>/ass/assTrailCarD/modifyDealInfo.do';
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: url,
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						saveFile("");//保存文件
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
					}else{
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		
		//设置显示/编辑属性
		function showOrEdit(data){
	    	var flag = $("#flag").val();
			var buyerTypeCd = data.buyerTypeCd;//$("#buyerTypeCd").val();
			//处置申请基础信息
			if(flag == "2"){//可编辑-发起人
				$("#yc_dealCar").find(".edit_fqr").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#yc_dealCar").find(".show_fqr").each(function (){
					$(this).addClass('Hide');
	        	});
				if(buyerTypeCd == "1"){//企业
					$("#yc_dealCar").find(".person_edit").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#yc_dealCar").find(".person_show").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#yc_dealCar").find(".company_edit").each(function (){
						$(this).removeClass('Hide');
		        	});
					$("#yc_dealCar").find(".company_show").each(function (){
						$(this).addClass('Hide');
		        	});
				}else if(buyerTypeCd == "2"){//个人
					$("#yc_dealCar").find(".person_edit").each(function (){
						$(this).removeClass('Hide');
		        	});
					$("#yc_dealCar").find(".person_show").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#yc_dealCar").find(".company_edit").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#yc_dealCar").find(".company_show").each(function (){
						$(this).addClass('Hide');
		        	});
				}
				$("#saveDealSell_apply").removeClass('Hide');
			}else{//不可编辑
				$("#yc_dealCar").find(".edit_fqr").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#yc_dealCar").find(".show_fqr").each(function (){
					$(this).removeClass('Hide');
	        	});
				//个人和企业信息-显示
				$("#yc_dealCar").find(".person_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#yc_dealCar").find(".company_edit").each(function (){
					$(this).addClass('Hide');
	        	});
				if(buyerTypeCd == "1"){//企业
					$("#yc_dealCar").find(".person_show").each(function (){
						$(this).addClass('Hide');
		        	});
					$("#yc_dealCar").find(".company_show").each(function (){
						$(this).removeClass('Hide');
		        	});
				}else if(buyerTypeCd == "2"){//个人
					$("#yc_dealCar").find(".person_show").each(function (){
						$(this).removeClass('Hide');
		        	});
					$("#yc_dealCar").find(".company_show").each(function (){
						$(this).addClass('Hide');
		        	});
				}
				$("#saveDealSell_apply").addClass('Hide');
				liger.get("buyerTypeCd").setDisabled(true);//处置接受人类型
				liger.get("sellChannelCd").setDisabled(true);//处置路径
			}
			//付款和收款信息
			if(flag == "4"){//可编辑-通知打款
				$("#yc_dealCar").find(".edit_payer").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#yc_dealCar").find(".show_payer").each(function (){
					$(this).addClass('Hide');
	        	});
				//$("#updateAssDealRecAmt").removeClass('Hide');
				$("#saveDealSell").removeClass('Hide');
			}else{
				$("#yc_dealCar").find(".edit_payer").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#yc_dealCar").find(".show_payer").each(function (){
					$(this).removeClass('Hide');
	        	});
				//$("#updateAssDealRecAmt").addClass('Hide');
				$("#saveDealSell").addClass('Hide');
			}
			//提车人信息
			if(flag == "7" || flag == "4"){//呈报人添加提车人信息-销售合同签署通知打款
				$("#yc_dealCar").find(".edit_picker").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#yc_dealCar").find(".show_picker").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#saveDealSell_picker").removeClass('Hide');
			}else{
				$("#yc_dealCar").find(".edit_picker").each(function (){
					$(this).addClass('Hide');
	        	});
				$("#yc_dealCar").find(".show_picker").each(function (){
					$(this).removeClass('Hide');
	        	});
				$("#saveDealSell_picker").addClass('Hide');
			}
		}
		
        var grid2 = $("#ligergrid2").ligerGrid({
            url: '<%=path%>/ass/assTrailCarD/initCostList.do?CAR_ID='+$("#deal_Id").val(),
            method: 'get',
            columns: [
                {display: '费用项', name: 'costTypeCd', minWidth: 120, align: 'center', enabledSort: false},
                {display: '金额', name: 'costAmt', minWidth: 100, align: 'center', enabledSort: false,
	            	render: function (rowdata, rowindex, value, column) { 
						var h = rowdata.costAmt / 100;
						return h;
					}},
                {display: '备注', name: 'costRem', minWidth: 150, align: 'center', enabledSort: false},
                {display: '操作', name: '', minWidth: 150, align: 'center', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if('${flag}' == '10'){
                        	  var h='<a class="sq-button-hasicon" style="cursor:pointer;" href="javascript:;" onclick="toUpdateCarCost(';
                              h+="'"+rowdata.id+"'";
                              h+=')"><i class="sqBtnIco_4"></i>修改</a>';
                              h+='<a class="sq-button-hasicon" style="cursor:pointer;" href="javascript:;" onclick="deleteCarCost(';
                              h+="'"+rowdata.id+"'";
                              h+=')"><i class="sqBtnIco_7"></i>删除</a>';
                              return h;
                        }
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            //height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            onSelectRow: function (rowdata,rowNum,rowEl) {
                $.extend(true, pageInApp, {seletedCompRow: rowdata});
            },
            onUnSelectRow: function (rowdata) {
                $.extend(true, pageInApp, {seletedCompRow: null});
            }
        });
        //grid.setHeight(100);

   	 
   	 	//修改提报费用
   	    function toUpdateCarCost(id){
   	        $.ligerDialog.open({
   	            width: 800,
   	            height: 450,
   	            title: '修改提报费用',
   	            url: '<%=path%>/ass/assTrailCarD/toUpdateCostPage.do?id=' + id
   	        });
   	    }
      	// 删除提报费用
   	    function deleteCarCost(id){
   	     $.ligerDialog.confirm("是否确认删除选中的提报费用数据?", function (flag) {
             if (flag == false)return;
             var wait_dialog;
             $.ajax({
                 type: 'post',
                 dataType: 'json',
                 data: {id: id},
                 url: '<%=path%>/ass/assTrailCarD/deleteCarCost.do',
                 beforeSend: function () {
                     wait_dialog = $.ligerDialog.SQalert({
                         content: LogUtils.LOG_CMM_DATA_LOADING,
                         SQ_type: "waitting"
                     });
                 },
                 success: function (msg) {
                     wait_dialog.close();
                     if (msg.success == 1) {
                         $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                         grid2.reload();
                     } else {
                         $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                     }
                 }
             });
         });
   	    }
   		//入库交接单
		function entryOrder(crflag){
			var tcMasterId = $("#tcMasterId").val();//拖车主表ID
			var tcDetailId = $("#tcDetailId").val();//拖车明细ID
			var paySchId = $("#wsPaySchId").val();//支付表ID
			var paySchNo = $("#wsPaySchNo").val();//支付表号
			var prjId = $("#prjId").val();//项目ID
			var param = '&&tcMasterId='+tcMasterId+'&&tcDetailId='+tcDetailId+'&&crflag='+crflag;
			param += '&&paySchId='+paySchId+'&&paySchNo='+paySchNo+'&&prjId='+prjId;
			Add_navTab('entryOrder'+tcDetailId,'车辆交接单','<%=path%>/ass/assTrailCarM/toWarehousePage.do?' + param);
		}
		//导出车辆交接单PDF
	    function exportAssCarHvPdf(){
	    	var tcDetailId = $("#tcDetailId").val();//拖车明细ID
	        window.location.href='<%=path%>/ass/assTrailCarD/exportAssCarHvPdf.do?tcDetailId='+tcDetailId;
	    }
		
	  	//初始化付款信息
		var grid = $("#ligergrid3").ligerGrid({
            url: '<%=path%>/ass/assTrailCarM/getAssDealRecAmtList.do?flag=1&dataTypeCd=1&dataId='+$("#deal_Id").val(),
            method: 'get',
            columns: [
                {display: '银行信息', name: 'payerBankNm', minWidth: 120, align: 'center', enabledSort: false},
                {display: '账号信息', name: 'payerAccNo', minWidth: 100, align: 'center', enabledSort: false},
                {display: '付款方名称', name: 'payerAccNm', minWidth: 150, align: 'center', enabledSort: false},
                {display: '付款金额(元)', name: 'payAmt', width: 100, align: 'center', enabledSort: false,
					render: function (rowdata, rowindex, value, column) { 
						var h = rowdata.payAmt / 100;
						return h;
					}},
				{display: '付款时间', name: 'payTm', width: 100, align:'center', enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = renderDate1(rowdata.payTm);
						return h;
					}},
				{display: '到账时间', name: 'receivedTm', width: 100, align:'center', enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = renderDate1(rowdata.receivedTm);
						return h;
					}},
                {display: '到账金额(元)', name: 'receivedAmt', width: 100, align: 'center', enabledSort: false,
					render: function (rowdata, rowindex, value, column) { 
						var h = rowdata.receivedAmt / 100;
						return h;
					}},
                {display: '使用金额(元)', name: 'useAmt', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, rowindex, value, column) {
                        var h = rowdata.useAmt / 100;
                        return h;
                    }},
                {display: '操作', name: '', minWidth: 150, align: 'center', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                    	var h='';
                        if('${flag}' == '4' || '${flag}' == '6'){//发起人/财务
							h+='<a class="sq-button-hasicon ' + l_hidden + '" style="cursor:pointer;" href="javascript:editPayInfo(';
							h+="'"+rowdata.id+"'";
							h+=')"><i class="sqBtnIco_4"></i>修改</a>';
							if('${flag}' == '4'){//发起人通知打款
								h+='<a class="sq-button-hasicon" style="cursor:pointer;" href="javascript:deletePayInfo(';
								h+="'"+rowdata.id+"'";
								h+=')"><i class="sqBtnIco_7"></i>删除</a>';
							}else{
								h+='<font class="sq-button-hasicon" color="c9c9c9"><i class="sqBtnIco_7"></i>删除</font>';
							}
						}else{
                          	h+='<font class="sq-button-hasicon" color="c9c9c9"><i class="sqBtnIco_4"></i>修改</font>';
                          	h+='<font class="sq-button-hasicon" color="c9c9c9"><i class="sqBtnIco_7"></i>删除</font>';
    					}
						return h;
                    }
                },
            ],
            //pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            heightDiff: -2,
            checkbox: true,
	        usePager: false,//是否分页
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            onSelectRow: function (rowdata,rowNum,rowEl) {
                $.extend(true, pageInApp, {seletedCompRow: rowdata});
            },
            onUnSelectRow: function (rowdata) {
                $.extend(true, pageInApp, {seletedCompRow: null});
            }
        });
        //添加付款信息
        function editPayInfo(id){
        	var param = id+"&dataId="+$("#deal_Id").val()+"&flag="+$("#flag").val()+"&goFlag=3";
			$.ligerDialog.open({
                width:800,
                height: 260,
                title: '编辑付款信息',
                url: '<%=path%>/ass/assTrailCarD/toRecAmtPage.do?assDealRecAmt_id='+param
			});
		}
      	//删除付款信息
   	    function deletePayInfo(id){
	   	    $.ligerDialog.confirm("是否确认删除选中的付款信息数据?", function (flag) {
	            if (flag == false)return;
	            var wait_dialog = null;
	            $.ajax({
	                type: 'post',
	                dataType: 'json',
	                data: {id: id},
	                url: '<%=path%>/ass/assTrailCarD/deleteRecAmt.do',
	                beforeSend: function () {
	                    wait_dialog = $.ligerDialog.SQalert({
	                        content: LogUtils.LOG_CMM_DATA_LOADING,
	                        SQ_type: "waitting"
	                    });
	                },
	                success: function (msg) {
	                    wait_dialog.close();
	                    if (msg.success == 1) {
	                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
	                        grid.reload();
	                    } else {
	                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
	                    }
	                }
	            });
	        });
   	    }

    </script>
</body>
</html>